int new_height)
{
GtkTextLayoutPrivate *priv = GTK_TEXT_LAYOUT_GET_PRIVATE (layout);
- gtk_text_line_display_cache_invalidate_y_range (priv->cache, layout, y, old_height, FALSE);
+ gtk_text_line_display_cache_invalidate_y_range (priv->cache, layout, y, old_height, new_height, FALSE);
gtk_text_layout_emit_changed (layout, y, old_height, new_height);
}
int new_height)
{
GtkTextLayoutPrivate *priv = GTK_TEXT_LAYOUT_GET_PRIVATE (layout);
- gtk_text_line_display_cache_invalidate_y_range (priv->cache, layout, y, old_height, TRUE);
+ gtk_text_line_display_cache_invalidate_y_range (priv->cache, layout, y, old_height, new_height, TRUE);
gtk_text_layout_emit_changed (layout, y, old_height, new_height);
}
* gtk_text_line_display_cache_invalidate_y_range:
* @cache: a GtkTextLineDisplayCache
* @y: the starting Y position
- * @old_height: the height to invalidate
+ * @old_height: the old height of the range
+ * @new_height: the new height of the range
* @cursors_only: if only cursors should be invalidated
*
* Remove all GtkTextLineDisplay that fall into the range starting
GtkTextLayout *layout,
int y,
int old_height,
+ int new_height,
gboolean cursors_only)
{
GSequenceIter *iter;
STAT_INC (cache->inval_by_y_range);
- if (y < 0)
+ /* A common pattern is to invalidate the whole buffer using y==0 and
+ * old_height==new_height. So special case that instead of walking through
+ * each display item one at a time.
+ */
+ if (y < 0 || (y == 0 && old_height == new_height))
{
gtk_text_line_display_cache_invalidate (cache);
return;
void gtk_text_line_display_cache_invalidate_y_range (GtkTextLineDisplayCache *cache,
GtkTextLayout *layout,
int y,
- int height,
+ int old_height,
+ int new_height,
gboolean cursors_only);
void gtk_text_line_display_cache_set_mru_size (GtkTextLineDisplayCache *cache,
guint mru_size);